home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 28 / PC Gamer IT CD 28 1-2.iso / MEDIA / REVIEWS.DXR / Internal_2_UtilityHandlers.ls < prev    next >
Encoding:
Text File  |  1997-12-01  |  4.9 KB  |  181 lines

  1. on openP
  2.   global DBfact, TBfact
  3.   set DBfact to xtra("V12Dbe")
  4.   set TBfact to xtra("V12Table")
  5. end
  6.  
  7. on createDB
  8.   global DBfact
  9.   set gDb to new(DBfact, the pathName & "reviews.db", "cr", "imagine")
  10.   mCreateTable(gDb, "reviews")
  11.   put mCreateField(gDb, "reviews", "category", "String", 255)
  12.   put mCreateField(gDb, "reviews", "appname", "String", 255)
  13.   put mCreateField(gDb, "reviews", "highs", "String", 2000)
  14.   put mCreateField(gDb, "reviews", "lows", "String", 2000)
  15.   put mCreateField(gDb, "reviews", "Bottomline", "String", 2000)
  16.   put mCreateField(gDb, "reviews", "Rating", "String", 10)
  17.   put mCreateField(gDb, "reviews", "AlphaSortKey", "String", 10)
  18.   put mCreateField(gDb, "reviews", "CoName", "String", 255)
  19.   put mCreateField(gDb, "reviews", "Address", "String", 255)
  20.   put mCreateField(gDb, "reviews", "City", "String", 255)
  21.   put mCreateField(gDb, "reviews", "State", "String", 255)
  22.   put mCreateField(gDb, "reviews", "Zip", "String", 255)
  23.   put mCreateField(gDb, "reviews", "Phone", "String", 255)
  24.   put mCreateField(gDb, "reviews", "Phone2", "String", 255)
  25.   put mCreateField(gDb, "reviews", "email", "String", 255)
  26.   put mCreateField(gDb, "reviews", "m/y/pg", "String", 255)
  27.   put mCreateIndex(gDb, "reviews", "catIdx", "d", "category", "a")
  28.   put mCreateIndex(gDb, "reviews", "nameIdx", "d", "appname", "a")
  29.   put mBuild(gDb)
  30.   set gDb to 0
  31. end
  32.  
  33. on openDB
  34.   global DBfact, TBfact, gDb, gTB
  35.   set gDb to new(DBfact, the pathName & "reviews.db", "ReadWrite", "imagine")
  36.   set gTB to new(TBfact, mGetRef(gDb), "reviews")
  37. end
  38.  
  39. on Import
  40.   global DBfact, TBfact, gDb, gTB
  41.   put mImportFile(gTB, the pathName & "reviews.txt", TAB, RETURN)
  42. end
  43.  
  44. on getOne
  45.   global gTB
  46.   put mGetField(gTB, "name", 1, 2)
  47. end
  48.  
  49. on listIt
  50.   global gTB
  51.   put EMPTY into field "theList"
  52.   set n to mSelectCount(gTB)
  53.   repeat with i = 1 to n
  54.     put mGetField(gTB, "category", "category") after field "theList"
  55.     mGoNext(gTB)
  56.   end repeat
  57. end
  58.  
  59. on closeP
  60.   global gTB, gDb
  61.   set gTB to 0
  62.   set gDb to 0
  63. end
  64.  
  65. on CreateIt
  66.   cursor(4)
  67.   openP()
  68.   createDB()
  69.   openDB()
  70.   Import()
  71.   closeP()
  72.   cursor(1)
  73. end
  74.  
  75. on ImportIt
  76.   openDB()
  77.   Import()
  78.   closeP()
  79. end
  80.  
  81. on showSelection
  82.   global gTB
  83.   cursor(4)
  84.   set n to mSelectCount(gTB)
  85.   put n into field "totalCount"
  86.   set temp to mGetPosition(gTB)
  87.   mGoFirst(gTB)
  88.   put EMPTY into field "TheList"
  89.   set dummy to EMPTY
  90.   repeat with i = 1 to n
  91.     set nm to mGetField(gTB, "appname")
  92.     put nm & RETURN after dummy
  93.     mGoNext(gTB)
  94.   end repeat
  95.   put dummy into field "TheList"
  96.   mGo(gTB, temp)
  97.   updateDisplay()
  98.   cursor(-1)
  99. end
  100.  
  101. on updateDisplay
  102.   global gTB
  103.   set i to mGetPosition(gTB)
  104.   set the foreColor of field "zlist" to 255
  105.   set the foreColor of line i of field "zlist" to 1
  106.   put mGetField(gTB, "category") into field "category"
  107.   put mGetField(gTB, "appname") into field "appname"
  108.   put mGetField(gTB, "highs") into field "highs"
  109.   put mGetField(gTB, "lows") into field "lows"
  110.   put mGetField(gTB, "BottomLine") into field "BottomLine"
  111.   put mGetField(gTB, "Rating") into field "Ratings"
  112.   put mGetField(gTB, "AlphaSortKey") into field "alphsortkey"
  113.   put field "Ratings" & "%" into field "Rating"
  114.   put mGetField(gTB, "CoName") into field "CoName"
  115.   put mGetField(gTB, "Address") into field "Address"
  116.   put mGetField(gTB, "City") into field "City"
  117.   put mGetField(gTB, "State") into field "State"
  118.   put mGetField(gTB, "Zip") into field "Zip"
  119.   put mGetField(gTB, "Phone") into field "Phone"
  120.   put mGetField(gTB, "Phone2") into field "Phone2"
  121.   put mGetField(gTB, "email") into field "email"
  122.   put mGetField(gTB, "m/y/pg") into field "m/y/pg"
  123.   put i into field "totalRecs"
  124. end
  125.  
  126. on domSelectCount
  127.   global gTB
  128.   put mSelectCount(gTB) into field "totalCount"
  129. end
  130.  
  131. on CheckError errCode, msg
  132.   global gDb
  133.   if errCode <> 0 then
  134.     if objectp(gDb) then
  135.       set errTxt to mError(gDb, errCode)
  136.     else
  137.       set errText to "unknown error"
  138.     end if
  139.     alert("Error" && errCode && "(" & errTxt & ") occured at" && msg)
  140.   end if
  141. end
  142.  
  143. on TrackClick
  144.   set spriteNum to the clickOn
  145.   set offCast to the castNum of sprite spriteNum
  146.   set onCast to offCast + 1
  147.   set the castNum of sprite spriteNum to onCast
  148.   updateStage()
  149.   repeat while the mouseDown
  150.     if rollOver(spriteNum) then
  151.       set the castNum of sprite spriteNum to onCast
  152.     else
  153.       set the castNum of sprite spriteNum to offCast
  154.     end if
  155.     updateStage()
  156.   end repeat
  157.   set the castNum of sprite spriteNum to offCast
  158.   updateStage()
  159.   return rollOver(spriteNum)
  160. end
  161.  
  162. on getdrive
  163.   set curpath to the moviePath
  164.   set olddelimiter to the itemDelimiter
  165.   set the itemDelimiter to "\"
  166.   set drive to item 1 of curpath & "\"
  167.   set the itemDelimiter to olddelimiter
  168.   return drive
  169. end
  170.  
  171. on restartMe
  172.   global DBfact, TBfact
  173.   clearGlobals()
  174.   openXLib(the pathName & "xtras:V12Dbe")
  175.   openXLib(the pathName & "xtras:V12Table")
  176.   set DBfact to xtra("V12Dbe")
  177.   set TBfact to xtra("V12Table")
  178.   set the visible of sprite 47 to 0
  179.   put "All Shareware" into field "fld"
  180. end
  181.